﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class zuidazhi
    {
        public void max1(int[] arr2, out int max, out int min, out int sum, out double avg)
        {
            sum = 0;
            max = arr2[0];
            min = arr2[0];
            avg = arr2[0];
            for (int i = 0; i < arr2.Length; i++)
            {
                sum += arr2[i];
                if (arr2[i] > max)
                {
                    arr2[i] = max;
                }
                else if (arr2[i] < min)
                {
                    arr2[i] = min;
                }
                avg = (sum * 1.0) / arr2.Length;
            }
        }
        public void max2(int[] arr2, ref int max, ref int min, ref int sum, ref double avg)
        {
            for (int i = 0; i < arr2.Length; i++)
            {
                sum += arr2[i];
                if (arr2[i] > max)
                {
                    arr2[i] = max;
                }
                else if (arr2[i] < min)
                {
                    arr2[i] = min;
                }
                avg = (sum * 1.0) / arr2.Length;
            }
        }
    }
}
